package org.reenscape.updater;
import org.reenscape.*;
public class RespawnObject {

		public static int[] current = new int[1000];
		public static int[] after = new int[1000];
		public static int[] timer = new int[1000];
		public static int[] x = new int[1000];
		public static int[] y = new int[1000];
		public static int[] face = new int[1000];
		
		public RespawnObject(){
			for(int i = 0; i < 1000; i++){
				current[i] = -1;
				after[i] = -1;
				timer[i] = -1;
				x[i] = -1;
				y[i] = -1;
				face[i] = -1;
			}
		}
		
		public void process(){
			for(int i = 0; i < 1000; i++){
				if(current[i] != -1){
					if(timer[i] == 0){
						//update for all
						globalUpdate(i);
						//then reset
						current[i] = -1;
						after[i] = -1;
						x[i] = -1;
						y[i] = -1;
						face[i] = -1;
					} else {
						timer[i]--;
					}
				}
			}
		}
		
		public void add(int c, int xv, int yv, int f, int t, int a){
			for(int i = 0; i < 1000; i++){
				if(current[i] == -1){
					//set new values
					current[i] = c;
					after[i] = a;
					timer[i] = t;
					x[i] = xv;
					y[i] = yv;
					face[i] = f;
					//update for all
					globalUpdate(i);
					break;
				}
			}
		}
		
		public void globalUpdate(int s){
			//this sends an update of the object when needed
		}
}